var webdriver = require('selenium-webdriver'),
    By = webdriver.By,
    until = webdriver.until;

let userInput = By.css('#user');
let passwordInput = By.css('#password');
let loginButton = By.css('#login-ent-btn')

function testlLogin(name, paw)
{
    var d = new webdriver.Builder()
    d.forBrowser("chrome")
    var driver = d.build();

    driver.manage().logs()
        .get('browser')
        .then(v => v && v.length && console.log(v));
    driver.get('http://192.168.1.220/User-login.html');
    driver.findElement(userInput).sendKeys(name);
    driver.findElement(passwordInput).sendKeys(paw);
    driver.findElement(loginButton).click();
    driver.close();
}
// testlLogin("zhl001", "123456");
// testlLogin("whj005", "123456");
function testGetLog()
{
    var builder = new webdriver.Builder()
    builder.forBrowser("chrome")
    var driver = builder.build();


    driver.get('http://localhost:7777/');

    //得到log列表
    driver.manage().logs()
        .get('browser')
        .then(v => v && v.length && console.log(v));

    driver.executeScript(() =>
    {
        console.log("hello execute");
    })
}

testGetLog();